<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\widgets\ListView;
use app\models\Type;
use app\models\Product;
use yii\helpers\Url;


/* @var $this yii\web\View */
/* @var $model app\models\Product */
/* @var $picDataProvider yii\data\ActiveDataProvider */
/* @var $showorderProvider yii\data\ActiveDataProvider */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '产品', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->pid], ['class' => 'btn btn-primary']) ?>
        <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->pid], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
                'method' => 'post',
            ],
        ]) ?>
        <?= Html::a('创建图片', ['pic/create', 'product_id' => $model->pid], ['class' => 'btn btn-primary']) ?>
    </p>
    <div class="wrapper wrapper-content  animated fadeInRight blog">
    <div class="page-content">
        <div class="panel panel-default">
            <div class="panel-heading"><?= Html::encode("图片") ?> </div>
            <div class="panel-body">
            <?= ListView::widget([
                'dataProvider'=>$picDataProvider,
                'itemView' => '_pic',
            ]);?>
            </div>
        </div>
    </div>
    </div>
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'pid',
            [
                'attribute' => 'type_id',
                'value'=>Type::dropdown('type',$model->type_id)
            ],
            'name',
            'spec',
            'hot',
            'market_val',
            'cost',
            'return_rate',
            'start_price',
            'scope',
            'fee',
            'degree',
            'lowest_price',
            'highest_price',
            'actcount',
            'reacount',
            [
                'attribute' => 'can_robot',
                'value'=>Product::dropdown('can_robot',$model->can_robot),
            ],
            [
                'attribute' => 'have_cost',
                'value'=>Product::dropdown('have_cost',$model->have_cost),
            ],
            [
                'attribute' => 'ios',
                'value'=>Product::dropdown('ios',$model->ios),
            ],
            [
                'attribute' => 'can_give',
                'value'=>Product::dropdown('can_give',$model->can_give),
            ],
            [
                'attribute' => 'kind',
                'value'=>Product::dropdown('kind',$model->kind),
            ],
            [
                'attribute' => 'can_show',
                'value'=>Product::dropdown('can_show',$model->can_show),
            ],
            [
                'attribute' => 'state',
                'value'=>Product::dropdown('state',$model->state),
            ],
            [
                'attribute' => 'created_at',
                'format' => ['date', 'php:Y-m-d']
            ],
            [
                'attribute' => 'updated_at',
                'format' => ['date', 'php:Y-m-d']
            ],
            [
                'label'=>'最近20期走势',
                'format' => 'raw',
                'value'=>Html::img(Url::to(['auction/img','product_id'=>$model->pid]),['width'=>'1200px','height'=>'400px']),
            ],
        ],
    ]) ?>
    <div class="wrapper wrapper-content  animated fadeInRight blog">
        <div class="page-content">
            <div class="panel panel-default">
                <div class="panel-heading"><?= Html::encode("晒单") ?> </div>
                <div class="panel-body">
                    <?= ListView::widget([
                        'dataProvider'=>$showorderDataProvider,
                        'itemView' => '_showorder',
                    ]);?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->beginBlock('css')?>
<?=Html::cssFile('@hplus/css/style.min.css')?>
<?=Html::cssFile('@hplus/css/font-awesome.min.css?v=4.4.0')?>
<?php $this->endBlock();?>
